home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d886.lha
/
TrackEd
/
Sources
/
ST2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-16
|
2KB
|
77 lines
/* ST2.c custom message window, OS2.0 only */
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <libraries/gadtools.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
extern struct TextAttr Style;
extern APTR My_VisualInfo;
struct Requester *BlockInput();
void UnBlockInput();
struct IntuiText
ST2Text2 = { 1, 0, JAM2, 0, 32, &Style, NULL, NULL },
ST2Text = { 1, 0, JAM2, 0, 22, &Style, NULL, &ST2Text2 };
#define ST2_OK 61
struct NewGadget ST2_OKNG =
{ 46, 52, 108, 12, NULL, &Style, ST2_OK, 0, NULL, NULL };
void ShowText2(window, text, text2, buttontext)
struct Window *window;
UBYTE *text, *text2, *buttontext;
{
struct IntuiMessage *imsg;
struct Requester *BI;
struct Window *STWindow;
struct Gadget *gad, *glist;
ULONG MW;
int i;
BI = BlockInput(window);
if (buttontext) ST2_OKNG.ng_GadgetText = buttontext;
else ST2_OKNG.ng_GadgetText = " OK ";
ST2Text.IText = text;
ST2Text2.IText = text2;
for (i = 0; ST2_OKNG.ng_GadgetText[i] != 0; i++);
MW = 8*i;
ST2_OKNG.ng_Width = (UWORD) MW+12;
if (IntuiTextLength(&ST2Text2) > MW) MW = IntuiTextLength(&ST2Text2);
if (IntuiTextLength(&ST2Text) > MW) MW = IntuiTextLength(&ST2Text);
MW += 32;
ST2Text.LeftEdge = (UWORD) (MW - IntuiTextLength(&ST2Text)) / 2;
ST2Text2.LeftEdge = (UWORD) (MW - IntuiTextLength(&ST2Text2)) / 2;
ST2_OKNG.ng_VisualInfo = My_VisualInfo;
ST2_OKNG.ng_LeftEdge = (UWORD) (MW - ST2_OKNG.ng_Width) / 2;
gad = CreateContext(&glist);
gad = CreateGadget(BUTTON_KIND, gad, &ST2_OKNG, TAG_END);
STWindow = OpenWindowTags(NULL, WA_Title, "Message",
WA_Gadgets, glist, WA_AutoAdjust, TRUE,
WA_Top, 40, WA_Left, 180,
WA_Width, MW, WA_InnerHeight, 60,
WA_DragBar, TRUE, WA_DepthGadget, TRUE,
WA_Activate, TRUE,
WA_IDCMP, BUTTONIDCMP, TAG_END);
PrintIText(STWindow->RPort, &ST2Text, 0L, 0L);
if (!(imsg = GT_GetIMsg(STWindow->UserPort)))
{
Wait(1L << STWindow->UserPort->mp_SigBit);
}
GT_ReplyIMsg(imsg);
CloseWindow(STWindow);
FreeGadgets(glist);
UnBlockInput(BI, window);
}